home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Devices / ATA Demo / ATA_powerpc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-14  |  2.0 KB  |  54 lines  |  [TEXT/CWIE]

  1. /*/*************************************************************************
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Macintosh ATA Manager Sample 
  5. **
  6. **    by Brian Bechtel, <devsupport@apple.com>
  7. **    Apple Developer Technical Support 
  8. **
  9. **    File:        ATA_powerpc.h
  10. **
  11. **    Copyright © 1997 Apple Computer, Inc.
  12. **    All rights reserved.
  13. **
  14. **    You may incorporate this sample code into your applications without
  15. **    restriction, though the sample code has been provided "AS IS" and the
  16. **    responsibility for its operation is 100% yours.  However, what you are
  17. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  18. **    after having made changes. If you're going to re-distribute the source,
  19. **    we require that you make it clear in the source that the code was
  20. **    descended from Apple Sample Code, but that you've made changes.
  21. **
  22. **************************************************************************/
  23.  
  24. /*/*************************************************************************
  25. ** This definition is only used if you are generating CFM.  In those cases,
  26. ** the "ataManager" call isn't defined.  See technote 1098 for details.
  27. **************************************************************************/
  28.  
  29. #if GENERATINGCFM
  30.  pascal SInt16 ataManager(ataPB *pb);
  31.  
  32. #define RESULT_OFFSET(type) \
  33.      ((sizeof(type) == 1) ? 3 : ((sizeof(type) == 2) ? 1 : 0))
  34.  #define TBTrapTableAddress(trapNum) (((trapNum & 0x03FF) << 2) + 0xE00)
  35.  
  36.  pascal SInt16 ataManager(ataPB *pb)
  37.  {
  38.      #ifdef applec
  39.          #if sizeof(SInt16) > 4
  40.              #error "Result types larger than 4 bytes are not supported."
  41.          #endif
  42.      #endif
  43.      long    private_result;
  44.  
  45.      private_result = CallUniversalProc(
  46.          *(UniversalProcPtr*)TBTrapTableAddress(0xAAF1),
  47.          kPascalStackBased
  48.           | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  49.           | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(pb))),
  50.          pb);
  51.      return *(((SInt16*)&private_result) + RESULT_OFFSET(SInt16));
  52.  }
  53. #endif 
  54.